package com.ycyun.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @Author: 哦谢特谢特
 * @Date: 2018/5/18 9:44
 * @Description: 线程池配置、启用异步
 */
//启用异步调用
@EnableAsync(proxyTargetClass = true)
public class AsycTaskExecutorConfig {

    //配置线程池
    @Bean
    public TaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setCorePoolSize(50);
        taskExecutor.setMaxPoolSize(100);

        return taskExecutor;
    }
}
